Form Open Options

Description

There are two ways to specify the name of a form or browse layout. These are:

  • by name

  • with a pointer that references the window (the preferred method)

When you open a form or browse layout, the window name is generally the same as the form or browse name (with two exceptions, described below).

  1. You may have opened more than one instance of the form or browse layout. Since a window name must be unique, Alpha Anywhere automatically appends a number to the layout name to differentiate the second and subsequent instances of that layout. For example, if you have a form called "CustomerList", which is opened twice, the first window will be called "CustomerList" and the second window may be called "CustomerList0".

  2. The Xbasic command to open a window allows you to specify the unique window name associated with the window. So, there is no guarantee that the window name for the "CustomerList" form is indeed "CustomerList".

When you open a form or browse window, you can optionally associate a pointer variable with the new window. This pointer allows you to uniquely identify the window when you want to perform some action on the window (such as closing, or hiding it) or on one of the objects contained within the window (such as entering a value into one of the controls on a form). For example, the following Xbasic commands opens the "CustomerList" form, and creates a pointer called "p1" that allows you to reference the window:

DIM p1 as P

P1 = form.view("CustomerList")
To close this window, you could use the Xbasic command:
P1.close()

The Button Genie allows you to specify four different ways to open a form or browse layout. These are:

  • Normal (Modeless)

  • Dialog (Modal)

  • Hidden, Normal (Modeless)

  • Hidden, Dialog (Modal)

Normal

This is the most common option. The form opens just as it would if you opened it from the Alpha Anywhere control panel. The window in which the form opens is modeless, meaning that you are free to leave the form open while continuing to work in other windows in Alpha Anywhere.

Dialog

The form opens in a modal window. This means that until the form is closed, you cannot work in any other window in Alpha Anywhere. You cannot make selections from the menu, or toolbar either. Choose this option if you want the user to complete work in the form that is opened before moving on to any other task in Alpha Anywhere.

Hidden, Normal

This is for advanced users. It opens the form as a normal, (modeless) window, but hides the form so that it is not visible to the user. Even though the form is hidden, it is still in memory and can be referenced by your Xbasic script. You refer to the hidden window by referencing the pointer variable that you specify when opening the Form. Typically, you would open a form as hidden so that you can manipulate some of the data on the form, or filter/sort the record displayed in the form before you show the form to the user. Once you have done this, then you use the .Activate() method to display the form and give it focus.

If you use a form method, such as .NEW_RECORD(), or .FETCH_NEXT(), the form will automatically be activated. You will not need to use the .ACTIVATE() method.

For example, assume that you opened the form as hidden, and assigned a pointer name to the form of varP_myform. The following Xbasic command (which can be inserted into an Action Script using the Inline Xbasic action) would show the form:

varP_myform.activate()

Here is another example: Open the Customer form as hidden, assigning a pointer called varPCustomer to reference the window. Then, using this pointer, enter a new record, set the value in some fields on the form, then show the form. Here is the Xbasic code that would do this:

varPCustomer = form.load("customer")
varPCustomer.new_record()
varPCustomer:lastname.text = "Smith"
varPCustomer.show()

Hidden, Dialog

Similar to the Hidden, Normal option, except that when the form is activated with the .ACTIVATE() method, it is activated as a modal window.

See Also